#!/bin/bash
yum -y install dhcp
systemctl start dhcpd
systemctl enable dhcpd
#指定划分网段，子网掩码
#指定划分范围 100-200
#指定dns服务器
#指定网关地址
#默认地址有效时间，时间到期会自动续期
echo "subnet 192.168.88.0 netmask 255.255.255.0 {
    range 192.168.88.100 192.168.88.200;
    option domain-name-servers 8.8.8.8;
    option routers 192.168.88.254;
    default-lease-time 600;
    max-lease-time 7200;
}
" >> /etc/dhcp/dhcp.conf
systemctl restart dhcpd